<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 父类
      function Person(name, age, sex) {
        this.name = name
        this.age = age
        this.sex = sex
      }
      // 子类
      function Student(name, age, sex, score) {
        Person.call(this, name, age, sex) // 此时父类的 this 指向子类的 this，同时调用这个函数
        this.score = score
      }
      var s1 = new Student('zs', 18, '男', 100)
      console.dir(s1)
      console.log('v2', s1)
      // a1
      console.log('v3', Person())

    </script>
  </body>
</html>
